Answer:

JFrame. (There is also an AWT Frame class, the parent class of JFrame).

Small GUI Program

Our first GUI program does not have a listener nor any application code, and is not a useful program. But it will get us started. Here is the complete program:

import java.awt.*;
import javax.swing.*;

public class TestFrame1 
{
  public static void main ( String[] args )
  {
    JFrame frame = new JFrame("Test Frame 1");
    frame.setSize(200,100);
    frame.setVisible( true );
    frame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
  }
}

First a JFrame is created by invoking its constuctor. The argument to the constructor sets the title of the frame. The setSize(200,100) method call makes the rectangular area 200 pixels wide by 100 pixels high.

The setVisible(true) method call makes the frame appear on the screen. If you forget to do this, the frame object will exist as an object in memory, but no picture will appear on the screen. A call to setVisible(false) makes the frame invisible, but does not destroy the software object.

It is easy to forget to include setVisible(true). If you run your GUI program, and nothing happens, check that you have called this method.

The setDefaultCloseOperation() method picks the action to perform when the "close" button of the frame is clicked. This is the little button usually at the top right of the frame. If you forget to call this method with the appropriate constant, clicks on the close button will be ignored.

QUESTION 3:

Is this program an application or an applet?